<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            static myname = "person类的名字"
            static mymethod = function () {
                console.log("mymethod")
            }
            constructor(name, age) {
                this.name = name
                this.age = age
            }
            say() {
                console.log(this.name, this.age)
            }
        }
        //可以继承属性和方法(静态的也可以)，可以重写父类方法等，使用super调用父类构造器，这些特点都与Java类似
        class Student extends Person {
            constructor(name, age, score) {
                super(name, age)
                this.score = score
            }
            getScore() {
                console.log(this.score)
            }
            say() {
                super.say()
                console.log(this.score)
            }
        }
        let obj = new Student("twj", 100, 149)
    </script>
</body>

</html>